package Calender;

import java.time.*;
import java.time.temporal.ChronoUnit;
import java.util.Calendar;
import java.util.Date;

public class Calenderdome {
    public static void main(String[] args) {
        Calendar calender = Calendar.getInstance();
        System.out.println(calender);


        Date date = new Date(0L);
        System.out.println(date);

        calender.setTime(date);
        System.out.println(calender);

        int year = calender.get(Calendar.YEAR);
        int month = calender.get(Calendar.MONTH+1);
        int day = calender.get(Calendar.DAY_OF_MONTH);
        System.out.println(year+"年"+month+"月"+day+"日");

        ZoneId zoneId = ZoneId.systemDefault();
        System.out.println(zoneId);

        Instant now = Instant.now();
        ZonedDateTime zonedDateTime =Instant.now().atZone(zoneId.of("Asia/Shanghai"));
        System.out.println(now);

        LocalDate now1 = LocalDate.now();
        System.out.println(now1);
        year = now1.getYear();
        month = now1.getMonthValue();
        day = now1.getDayOfMonth();
        System.out.println(year+"年"+month+"月"+day+"日");
        LocalDate now2 = now1.withMonth(2);
        System.out.println(now2);
        LocalDate now3 = now1.plusDays(1);
        System.out.println(now3);
        LocalDateTime now4 = LocalDateTime.of(2021, 12, 2,0,0,0);
        LocalDateTime now5 = LocalDateTime.now();
        System.out.println(now4.equals(now5));

        /*Period period = Period.between(now4, now5);
        System.out.println(period);*/


        Duration duration = Duration.between(now4,now5);
        System.out.println(duration);
        ChronoUnit.YEARS.between(now4,now5);
        System.out.println(ChronoUnit.YEARS.between(now4,now5));
    }
}
